/**
 * Captain
 * © 2017 Captain copyright，All rights reserved.
 * http://www.sccaptain.com.cn
 * 
 * JAVA : 8
 * 文  件  名: Expression.java
 * 创  建  人: liutao (liu.tao@sccaptain.com.cn)
 * 创建时间: 2017年8月7日 上午9:43:38
 * 版         本: 1.0.0
 * 备         注:
 * 修订历史:
 */
package com.material.c2c.core.criteria;

import java.io.Serializable;

/**
 * 
 * @since 1.0
 * @version 1.0
 * @author liutao (liu.tao@sccaptain.com.cn)
 */
public class CustomExpression implements Serializable{

  private static final long serialVersionUID = -816024687748545979L;
  
  public enum Logic{
    
    AND(" and "),
    OR(" or ");
    
    private String logic;
    
    Logic(String logic){
      this.setLogic(logic);
    }

    public String getLogic() {
      return logic;
    }

    public void setLogic(String logic) {
      this.logic = logic;
    }
  }
  
  public enum Operator{
    
    EQUAL(" = "),
    GREATER(" > "),
    LESS(" < "),
    GREATEREQUAL(" >= "),
    LESSEQUAL(" <= "),
    STARTSWITH("startsWith"),
    ENDWITH("endWith"),
    CONTAINS("contains");
    
    Operator(String operator) {
      this.operator = operator;
    }

    private String operator;

    public String getOperator() {
      return operator;
    }

    public void setOperator(String operator) {
      this.operator = operator;
    }
  }
  
  public enum FieldType{
    
    INT("int"),
    FLOAT("float"),
    DOUBLE("double"),
    DATE("date"),
    STRING("string");
    
    FieldType(String fieldType){
      this.fieldType = fieldType;
    }
    
    private String fieldType;

    public String getFieldType() {
      return fieldType;
    }

    public void setFieldType(String fieldType) {
      this.fieldType = fieldType;
    }
    
    
  }
  
  private String field;  //字段
  private String fieldType; //字段类型
  private Object value;  //值
  private String operator; //运算符: 
  private String logic;  //与或 and/or
  private String pattern; //日期格式
  
  CustomExpression[] children;

  public String getField() {
    return field;
  }

  public void setField(String field) {
    this.field = field;
  }
  
  public String getFieldType() {
    return fieldType;
  }

  public void setFieldType(String fieldType) {
    this.fieldType = fieldType;
  }

  public Object getValue() {
    return value;
  }

  public void setValue(Object value) {
    this.value = value;
  }

  public String getOperator() {
    return operator;
  }

  public void setOperator(String operator) {
    this.operator = operator;
  }

  public String getLogic() {
    return logic;
  }

  public void setLogic(String logic) {
    this.logic = logic;
  }

  public CustomExpression[] getChildren() {
    return children;
  }

  public void setChildren(CustomExpression[] children) {
    this.children = children;
  }

  public String getPattern() {
    return pattern;
  }

  public void setPattern(String pattern) {
    this.pattern = pattern;
  }
  
}
